# Final Project - Unemployment and stock data from currency and banks

Purpose

Unemployment trends has been a major player in both the political and financial realms of the United States. It is vital to keep track of unemployment as it has the potential to impact many people and industries in the country. Then we were looking for the possible factors that might affect the unemployment rate. Firstly, we thought stock would be a great factor, but it was also very broad. Then we chose the currency and financial banks as the main factor to analysis, since we think those two factors related the most to the companies and exporting and inporting problems. Our purpose is going to find a model to show how the currency stock and the bank company stock related to the unemployment rate.

Dataset

We have data downloaded from website https://data.bls.gov/timeseries/LNS14000000 to get the unemployment rate in the US from 2007 to 2016. For the stock rate for each banks and currency rate, we got the data from yahoo finance. https://finance.yahoo.com/industries/financial. We got the stock data for the top five companies monthly from the start of 2007 to the end of 2016. Our focus would on the ‘close’ rate for that.

Bank vs U.S unemployment rate

  • Variable names of the data

wClose is the close price for Wells fargo, bClose is the close price for Bank of America, cClose is the close price for citigroup, hClose is the close price fo HSBC, and then jClose is the close price for JPMorgan, unemployment is just the unemployment rate each month.

## [1] "Date"         "wClose"       "unemployment" "bClose"      
## [5] "cClose"       "hClose"       "jClose"

After viewing this, we have a graph to plot how these stocks varies with the unemployment rate each month from 2007 to 2016. Then we got the first plot.

  • Plot of unemployment rate and bank stock changing each month

From this plot, we can actually see a basic trend that while bank stock is increasing, the unemployment is decreasing. However, while the bank stock is decreasing, the unemployment rate is increasing. Then we are thinking there might be some relationships between them, so we decided to do some modeling to check what is actually affecting them.

Methods and Result

Linear regression was the first type of regression analysis to be studied rigorously, and to be used extensively in practical applications. This is because models which depend linearly on their unknown parameters are easier to fit than models which are non-linearly related to their parameters and because the statistical properties of the resulting estimators are easier to determine. We also find that linear regression model works good for continuous dataset. So that’s why we chose linear regression model.

## 
## Call:
## lm(formula = unemployment ~ wClose, data = totalData)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.9769 -0.8313  0.5009  0.8883  2.4500 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 11.09289    0.46553  23.828  < 2e-16 ***
## wClose      -0.11002    0.01201  -9.164  1.9e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.421 on 118 degrees of freedom
## Multiple R-squared:  0.4158, Adjusted R-squared:  0.4108 
## F-statistic: 83.97 on 1 and 118 DF,  p-value: 1.904e-15

From this summary, we can tell that estimate coefficient for Wells Fargo stock rate and unemployment is -0.11002, and it is pretty siginificant since Pr value is really small. Which indicates there’s really some relation between them.

## 
## Call:
## lm(formula = unemployment ~ bClose, data = totalData)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.65220 -1.10863  0.04433  0.76897  2.82819 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  8.68061    0.24825  34.968  < 2e-16 ***
## bClose      -0.09013    0.01111  -8.111 5.34e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.489 on 118 degrees of freedom
## Multiple R-squared:  0.358,  Adjusted R-squared:  0.3525 
## F-statistic: 65.79 on 1 and 118 DF,  p-value: 5.338e-13

From this summary, we can tell that estimate coefficient for Bank of America stock rate and unemployment is -0.09013, and it is pretty siginificant since Pr value is really small. Which indicates there’s really some relation between them.

## 
## Call:
## lm(formula = unemployment ~ cClose, data = totalData)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.7254 -1.0433  0.2645  0.8927  2.7359 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  9.293245   0.228008   40.76   <2e-16 ***
## cClose      -0.070344   0.006019  -11.69   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.265 on 118 degrees of freedom
## Multiple R-squared:  0.5365, Adjusted R-squared:  0.5326 
## F-statistic: 136.6 on 1 and 118 DF,  p-value: < 2.2e-16

From this summary, we can tell that estimate coefficient for Citigroup stock rate and unemployment is -0.070344, and it is pretty siginificant since Pr value is really small. Which indicates there’s really some relation between them.

## 
## Call:
## lm(formula = unemployment ~ hClose, data = totalData)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -3.05301 -1.25275  0.02141  1.38006  3.08693 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  8.900612   0.544788  16.338  < 2e-16 ***
## hClose      -0.035376   0.009667  -3.659 0.000379 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.761 on 118 degrees of freedom
## Multiple R-squared:  0.1019, Adjusted R-squared:  0.09431 
## F-statistic: 13.39 on 1 and 118 DF,  p-value: 0.0003794

From this summary, we can tell that estimate coefficient for HSBC stock rate and unemployment is -0.035376, and it is pretty siginificant since Pr value is really small. Which indicates there’s really some relation between them.

## 
## Call:
## lm(formula = unemployment ~ jClose, data = totalData)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.88261 -0.69950  0.08096  0.98291  2.53481 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 11.92118    0.54865  21.728  < 2e-16 ***
## jClose      -0.10181    0.01102  -9.237 1.28e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.416 on 118 degrees of freedom
## Multiple R-squared:  0.4196, Adjusted R-squared:  0.4147 
## F-statistic: 85.33 on 1 and 118 DF,  p-value: 1.278e-15

From this summary, we can tell that estimate coefficient for JPMorgan stock rate and unemployment is -0.10181, and it is pretty siginificant since Pr value is really small. Which indicates there’s really some relation between them.

According to the summary of five linear models of five banks and unemployment rate, we find all of there stock rates really affecting the unemployment rate. And the Wells Fargo affect the unemployment rate the most, since it has the largest absolute coefficient value. Maybe due to it is ranked the first place at the stock marketing.

Currency vs U.S unemployment rate

We want to exame the relationship of different country’s currency with U.S unemployment rate. And be able to pick one or two countries that would become the indicator for U.S unemployment rate. We picked: India, China, Japan, Canada, Russia, EU, Brazil, Korea. We picked these countries base on their perfermance on its ecomomic among the world abd also their relationship with the U.S.

Methods and Result

As the same as Bank one, we are also going to use linear regression here. We exame each country and pick the most representative country. Next, let see which country has the most relevant relationship with U.S unemployment rate. To do that, we will draw the line chart, as well as calculate the slope and correlation for each country compare to the U.S unemployment rate.

Below are the sample data we are going to use.

X India Japan China Korea Canada Brazil Russia European.Union unemploymentRate wellsfargo
Jan 2007 44.33947 120.5784 7.789589 936.3591 1.175932 2.138282 26.53018 1.299864 4.6 35.92
Feb 2007 44.16235 120.4463 7.754627 937.3625 1.170660 2.094159 26.32222 1.307420 4.5 34.70
March 2007 44.02550 117.2757 7.738982 943.2571 1.166915 2.091040 26.10818 1.324186 4.4 34.43

India

The line chart of India Currency vs U.S unemployment Rate

The correlation between India Currency and U.S enemployment Rate

## 
## Call:
## lm(formula = unemploymentRate ~ India, data = masterCur)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -3.457 -1.087  0.347  1.446  2.561 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 10.73541    0.95191  11.278  < 2e-16 ***
## India       -0.07056    0.01771  -3.985 0.000117 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.745 on 118 degrees of freedom
## Multiple R-squared:  0.1186, Adjusted R-squared:  0.1111 
## F-statistic: 15.88 on 1 and 118 DF,  p-value: 0.0001174

Japan

The line chart of Japan Currency vs U.S unemployment Rate

The correlation between Japan Currency and U.S enemployment Rate

## 
## Call:
## lm(formula = unemploymentRate ~ Japan, data = masterCur)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.9080 -0.6290 -0.0692  0.5645  2.2409 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  17.7295     0.6536   27.13   <2e-16 ***
## Japan        -0.1078     0.0065  -16.59   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.018 on 118 degrees of freedom
## Multiple R-squared:    0.7,  Adjusted R-squared:  0.6974 
## F-statistic: 275.3 on 1 and 118 DF,  p-value: < 2.2e-16

China

The line chart of China Currency vs U.S unemployment Rate

The correlation between China Currency and U.S enemployment Rate

## 
## Call:
## lm(formula = unemploymentRate ~ China, data = masterCur)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.3733 -1.5802 -0.2621  1.7998  3.1979 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  12.9988     2.5079   5.183 9.13e-07 ***
## China        -0.9076     0.3784  -2.399    0.018 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.815 on 118 degrees of freedom
## Multiple R-squared:  0.0465, Adjusted R-squared:  0.03842 
## F-statistic: 5.754 on 1 and 118 DF,  p-value: 0.01801

Korea

The line chart of Korea Currency vs U.S unemployment Rate

The correlation between Korea Currency and U.S enemployment Rate

## 
## Call:
## lm(formula = unemploymentRate ~ Korea, data = masterCur)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.9497 -1.1179  0.0183  1.2684  2.8731 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -2.193131   1.603859  -1.367    0.174    
## Korea        0.008252   0.001434   5.754 6.99e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.642 on 118 degrees of freedom
## Multiple R-squared:  0.2191, Adjusted R-squared:  0.2125 
## F-statistic: 33.11 on 1 and 118 DF,  p-value: 6.994e-08

Canada

The line chart of Canada Currency vs U.S unemployment Rate

The correlation between Canada Currency and U.S enemployment Rate

## 
## Call:
## lm(formula = unemploymentRate ~ Canada, data = masterCur)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.3904 -0.7752 -0.1901  1.0309  3.0020 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   15.924      1.345  11.835  < 2e-16 ***
## Canada        -8.087      1.212  -6.675 8.51e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.584 on 118 degrees of freedom
## Multiple R-squared:  0.2741, Adjusted R-squared:  0.2679 
## F-statistic: 44.55 on 1 and 118 DF,  p-value: 8.508e-10

Russia

The line chart of Russia Currency vs U.S unemployment Rate

The correlation between Raussia Currency and U.S enemployment Rate

## 
## Call:
## lm(formula = unemploymentRate ~ Russia, data = masterCur)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.2594 -0.8160 -0.0119  1.4632  2.5516 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  9.16480    0.41732  21.961  < 2e-16 ***
## Russia      -0.05830    0.01046  -5.575 1.59e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.654 on 118 degrees of freedom
## Multiple R-squared:  0.2085, Adjusted R-squared:  0.2018 
## F-statistic: 31.08 on 1 and 118 DF,  p-value: 1.592e-07

Brazil

The line chart of Brazil Currency vs U.S unemployment Rate

The correlation between Brazil Currency and U.S enemployment Rate

## 
## Call:
## lm(formula = unemploymentRate ~ Brazil, data = masterCur)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.0913 -0.6786  0.2738  0.9613  2.1544 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  10.7288     0.5008  21.424  < 2e-16 ***
## Brazil       -1.6595     0.2140  -7.755 3.47e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.513 on 118 degrees of freedom
## Multiple R-squared:  0.3376, Adjusted R-squared:  0.332 
## F-statistic: 60.14 on 1 and 118 DF,  p-value: 3.472e-12

EU

The line chart of EU Currency vs U.S unemployment Rate

The correlation between EU Currency and U.S enemployment Rate

## 
## Call:
## lm(formula = unemploymentRate ~ European.Union, data = masterCur)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.4084 -1.0496 -0.1852  1.4807  2.8904 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    -0.02626    1.67932  -0.016    0.988    
## European.Union  5.35515    1.27498   4.200  5.2e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.734 on 118 degrees of freedom
## Multiple R-squared:  0.1301, Adjusted R-squared:  0.1227 
## F-statistic: 17.64 on 1 and 118 DF,  p-value: 5.204e-05

From the chart we can see, China, Canada, Brazil, EU has really strong relationship with the U.S unemployment rate. Base and those 4 country are actually from the four different geolocation, so it’s a perfectly predicator to the U.S. unemployemnt rate. Then we are going to use the 4 country with the 1 bank we pick priously to generate a final linear regression.

Final Fit with Wells Fargo and the Four Country

The line chart of 4 countries Currencym wells fargo stock prices vs U.S unemployment Rate We did some change with the original data to make it more presentable. We mutiple Canada, EU, Brazil’s currency rate by 6, Divided wells fargo’s stock prices by 3, leave the unempoyment and Chinese currency unchanged. Below is the graph of the map.

The correlation between the currency, stock prices and U.S enemployment Rate We could see, from the line charts, the wells fargo is a good indicator for the unemployment rate, but it has smallest correlation compare to other 4 countries. Also the below indicates the four countries don’t show strong relationship with the unemployment if we going to do mutilinear regression, it won’t work.

## 
## Call:
## lm(formula = unemploymentRate ~ masterCur$Japan + masterCur$European.Union + 
##     masterCur$Canada + masterCur$Brazil + masterCur$wellsfargo, 
##     data = masterCur)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.84081 -0.80852 -0.03987  0.62622  2.13364 
## 
## Coefficients:
##                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)              17.24913    3.00355   5.743 7.85e-08 ***
## masterCur$Japan          -0.09622    0.01020  -9.430 5.93e-16 ***
## masterCur$European.Union -1.74538    1.49755  -1.165   0.2463    
## masterCur$Canada          4.46324    2.28897   1.950   0.0536 .  
## masterCur$Brazil         -1.25502    0.52311  -2.399   0.0181 *  
## masterCur$wellsfargo     -0.01322    0.01702  -0.777   0.4388    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9714 on 114 degrees of freedom
## Multiple R-squared:  0.7361, Adjusted R-squared:  0.7246 
## F-statistic: 63.61 on 5 and 114 DF,  p-value: < 2.2e-16

So, then, we tried the average of the four contry:

And it significant value and correlation line is below.

## 
## Call:
## lm(formula = unemploymentRate ~ avg + wellsfargo, data = masterCur)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.7937 -0.2764  0.1955  0.6825  1.9511 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 16.31225    0.97988  16.647  < 2e-16 ***
## avg         -0.80856    0.13780  -5.867 4.21e-08 ***
## wellsfargo  -0.03822    0.01619  -2.361   0.0199 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.254 on 117 degrees of freedom
## Multiple R-squared:  0.5486, Adjusted R-squared:  0.5409 
## F-statistic: 71.09 on 2 and 117 DF,  p-value: < 2.2e-16

Finally we pick the most influencial contry which is Canada, and did a linear regression agaain:

## 
## Call:
## lm(formula = unemploymentRate ~ Canada + wellsfargo, data = masterCur)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.2142 -0.2636  0.3596  0.6200  2.1796 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 14.31378    1.19905  11.938  < 2e-16 ***
## Canada      -3.68132    1.26955  -2.900  0.00446 ** 
## wellsfargo  -0.08737    0.01402  -6.231 7.56e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.378 on 117 degrees of freedom
## Multiple R-squared:  0.4549, Adjusted R-squared:  0.4456 
## F-statistic: 48.83 on 2 and 117 DF,  p-value: 3.823e-16

Discussion and Result

From our chart and the result of our linear regression, we find out that Canada, and wells fargo are the best indicators of U.S emoloyment Rate. We could also use the average of the four countries: Japan, Canada, Brazil, EU as an indicator as well.